<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>post请求</title>
  <link rel="shortcut icon" href="../img/favicon.ico" type="image/x-icon" />
  <script src='../js/jquery-3.4.1.js'></script>
  <script>
    $(function() {
      $.ajax({
        url: 'http://127.0.0.1:8012/login',
        type: "post",
        data: {
          username: 'admin',
          password: '123456'
        },
        success(res) {
          res = JSON.parse(res)
          console.log(res);
          if (res.meta.status !== 200) {
            $('#username').html(res.meta.msg)
          } else {
            $('#username').html(res.data.username)
          }
        },
        error(e) {
          console.log(e);
        }
      })
    })
  </script>
</head>

<body>
  <h3 id='username'></h3>
</body>

</html>